package com.bookshop.vo;

import com.bookshop.book.logic.Book;
import com.bookshop.promotion.logic.DiscountCoupons;
import com.bookshop.promotion.logic.EqualCoupons;
import com.bookshop.promotion.logic.PersonalPromotion;
import com.bookshop.user.identify.UserIdentity;
import com.bookshop.user.logic.CustomerInfo;
import com.bookshop.user.logic.User;

public class CustomerVO implements ValueObject{
	
	private static final long serialVersionUID = -3524894390408921350L;
	
	public String mAccount;
	public String mPassword;
	public double mCreditPoints;
	public String mName;
	public String mCellNumber;
	public String mAddress;
	public EqualCoupons[] mEqualCoupons;
	public DiscountCoupons[] mDiscountCoupons;
	

	public void update(String pAccount,String pPassword,String pName,String pCellNumber,String pAddress,double pCreditPoints, EqualCoupons[] pEqualCoupons,DiscountCoupons[] pDiscountCoupons){
		mAccount=pAccount;
		mPassword=pPassword;
		mName=pName;
		mCellNumber=pCellNumber;
		mAddress=pAddress;
		mCreditPoints=pCreditPoints;
		mEqualCoupons=pEqualCoupons;
		mDiscountCoupons=pDiscountCoupons;
	}
	
	public User toUser(){
		Book[] collectionBooks = new Book[0];
		PersonalPromotion personalPromotion = new PersonalPromotion(0, mEqualCoupons, mDiscountCoupons);
		CustomerInfo customerInfo = new CustomerInfo(mAccount,mName,mCellNumber,mAddress,collectionBooks,personalPromotion);
		User user = new User(mAccount, mPassword, UserIdentity.CUSTOMER, customerInfo);
		return user;
	}
	
}
